/**
 * 添加或者修改页面
 */
var ShiProductFunctionInfoDlg = {
    data: {
        name: "",
        heads: "",
        shoulder: "",
        backs: "",
        buttocks: "",
        handrail: "",
        calfs: "",
        appends: "",
        basicParameter: "",
        productSpecification: "",
        remarks: "",
        productOrderId: "",
        productOrderName: ""
    }
};

layui.use(['form', 'admin', 'ax'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;

    //让当前iframe弹层高度适应
    admin.iframeAuto();

    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/shiProductFunction/addItem", function (data) {
            Feng.success("添加成功！");
            window.location.href = Feng.ctxPath + '/shiProductFunction'
        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

    //返回按钮
    $("#backupPage").click(function () {
        window.location.href = Feng.ctxPath + '/shiProductFunction/index'
    });

    $("#name").click(function () {
        layer.open({
            type: 2,
            title: '产品品号选择',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/productOrder',
            end: function () {
                console.log(parent.ShiProductFunctionInfoDlg.data);
            }
        });
    });
    $("#heads").click(function () {
        layer.open({
            type: 2,
            title: '头部功能添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiHeadFunction/add',
            end: function () {

            }
        });
    });
    $("#shoulder").click(function () {
        layer.open({
            type: 2,
            title: '肩部功能添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiShoulderFunction/add',
            end: function () {

            }
        });
    });
    $("#backs").click(function () {
        layer.open({
            type: 2,
            title: '肩部功能添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiBackFunction/add',
            end: function () {

            }
        });
    });
    $("#buttocks").click(function () {
        layer.open({
            type: 2,
            title: '臀部功能添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiHipFunction/add',
            end: function () {

            }
        });
    });
    $("#handrail").click(function () {
        layer.open({
            type: 2,
            title: '扶手功能添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiHandrailFunction/add',
            end: function () {

            }
        });
    });
    $("#calfs").click(function () {
        layer.open({
            type: 2,
            title: '小腿功能添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiCalfFunction/add',
            end: function () {

            }
        });
    });
    $("#appends").click(function () {
        layer.open({
            type: 2,
            title: '附加功能添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiAdditionalFunction/add',
            end: function () {

            }
        });
    });
    $("#basicParameter").click(function () {
        layer.open({
            type: 2,
            title: '基本参数添加',
            area: ['600px', '400px'],
            content: Feng.ctxPath + '/shiBasicParameter/add',
            end: function () {

            }
        });
    });



});